package com.module.service.impl;

import cn.hutool.json.JSON;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.module.api.Message;
import com.module.service.PublishService;
import org.springframework.stereotype.Component;

import javax.jws.WebService;
import java.util.ArrayList;
@WebService(name = "PublishService",
        targetNamespace = "http://service.module.com",
        endpointInterface="com.module.service.PublishService")

@Component
public class PublishServiceImpl implements PublishService {
    @Override
    public String helloService(String name) {
        return name;
    }

    @Override
    public String getAllBean() {
        JSONArray messages = JSONUtil.createArray();
        for (int i = 1; i <=10 ; i++) {
            Message message = new Message();
            message.setMsg("第"+i+"条消息");
            message.setDescription("来自webservice的服务调用");
            messages.add(message);
        }
        return messages.toString();

    }
}
